
import inbound.HttpInboundServer;
import property.RouteProperty;
import util.YamlUtil;



public class ServerApplication {

    public final static String GATEWAY_NAME = "gateway";
    public final static String GATEWAY_VERSION = "3.0.0";



    public static void main(String[] args) {
        YamlUtil<RouteProperty> yamlUtil=new YamlUtil<>();
        RouteProperty routeProperty = yamlUtil.getYml(RouteProperty.class,"application.yml");
        String proxyPort = System.getProperty("proxyPort","8888");
        int port = Integer.parseInt(proxyPort);
        System.out.println(GATEWAY_NAME + " " + GATEWAY_VERSION +" starting...");
        HttpInboundServer server = new HttpInboundServer(port, routeProperty);
        System.out.println(GATEWAY_NAME + " " + GATEWAY_VERSION +" started at http://localhost:" + port + " for server:" + server.toString());
        try {
            server.run();
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
